import Vue from 'vue';
import axios from "axios";
import apiConfig from "./apiConfig";


//接口
for (let k in apiConfig) {
  Vue.prototype[k] = apiConfig[k];
}
const Axios = axios.create({
  timeout: 10000,
  responseType: "json",
  headers: {
    'Content-Type': 'application/json',
  }
});
// let loadAll;
// Axios.interceptors.request.use(
// config => {
//   return config;
// },
// err => {
//   return Promise.reject(err);
// });

Axios.interceptors.response.use(
  response => {
  if (response.data.code === 200) {
    //操作成功返回数据
    return response.data;
  } else {
    return false;
  }
},
error => {
  if (error.response) {
    return Promise.reject(error)
  }
}
);
export default Axios

